// 
// Decompiled by Procyon v0.5.30
// 

package com.baturu.vin.benz.dto.footnote;

import com.baturu.vin.benz.dto.BenzVinInfoDTO;
import com.baturu.vin.benz.service.impl.util.BenzStringUtil;
import org.apache.commons.lang3.StringUtils;

import javax.swing.table.TableCellRenderer;
import java.io.Serializable;

public abstract class Footnote implements Serializable {
    protected String group;
    protected String fNoteNum;
    protected String listNum;
    protected String abbr;
    protected String text;
    protected String revVer;
    protected String specVer;
    protected boolean isColor;
    protected boolean isSerial;
    protected boolean hasBeenChecked;
    protected boolean hasMoreElements;
    protected String kb;
    protected boolean isCKD;
    protected String ident;
    protected String date;
    protected String modelyr;
    protected int lastValidReturnValue;
    protected boolean isAssociated;
    protected boolean needToReprocessText;
    protected String es2Codes;
    protected String codeBs;
    public boolean isAccessoryFootnote;
    protected String linkedFoootnotes;
    protected boolean hasLink;
    private String lang;
    private int seqNum;
    private boolean hasWISLink;
    protected float codeBScore;
    private String fnRecGrp;
    private String catSource;

    public Footnote() {
        this.group = "";
        this.fNoteNum = "";
        this.listNum = "";
        this.abbr = "";
        this.text = "";
        this.revVer = "";
        this.specVer = "";
        this.isColor = false;
        this.isSerial = false;
        this.hasBeenChecked = false;
        this.hasMoreElements = false;
        this.kb = "";
        this.isCKD = false;
        this.lastValidReturnValue = 0;
        this.isAssociated = false;
        this.needToReprocessText = false;
        this.es2Codes = "";
        this.codeBs = "";
        this.isAccessoryFootnote = false;
        this.linkedFoootnotes = "";
        this.hasLink = false;
        this.lang = "";
        this.hasWISLink = false;
    }

    public boolean hasWISLink() {
        return this.hasWISLink;
    }

    public void setWISLink(boolean val) {
        this.hasWISLink = val;
    }

    public boolean isColor() {
        return this.isColor;
    }

    public boolean isSerial() {
        return this.isSerial;
    }

    public boolean hasLinkedFootnotes() {
        this.parseNeutralText();
        return this.hasLink;
    }

    public boolean isAccessoryFootnotes() {
        this.parseNeutralText();
        return this.isAccessoryFootnote;
    }

    public boolean isAccessoryFootnote() {
        return this.isAccessoryFootnote;
    }

    protected int setValid(int valid) {
        this.hasBeenChecked = true;
        return this.lastValidReturnValue = valid;
    }

    public int getValidStatus() {
        return this.lastValidReturnValue;
    }

    public boolean isCKD() {
        return this.isCKD;
    }

    public void setCKD(boolean CKD) {
        this.isCKD = CKD;
    }

    public boolean isAggTypeMatchingAbbr(String aggType, String abbr) {
        if (StringUtils.isBlank(aggType) || StringUtils.isBlank(abbr) || abbr.length() < 3) {
            return false;
        }
        String agg = abbr.substring(2);
        return (agg.equalsIgnoreCase("L") && aggType.equalsIgnoreCase("LG")) || (agg.equalsIgnoreCase("V") && aggType.equalsIgnoreCase("VA")) || (agg.equalsIgnoreCase("H") && aggType.equalsIgnoreCase("HA")) || (agg.equalsIgnoreCase("A") && aggType.equalsIgnoreCase("FH")) || (agg.equalsIgnoreCase("G") && (aggType.equalsIgnoreCase("GA") || aggType.equalsIgnoreCase("GM"))) || (agg.equalsIgnoreCase("M") && aggType.equalsIgnoreCase("M")) || (agg.equalsIgnoreCase("F") && aggType.equalsIgnoreCase("FG")) || (agg.equalsIgnoreCase("Z") && aggType.equalsIgnoreCase("VG")) || (agg.equalsIgnoreCase("P") && aggType.equalsIgnoreCase("P"));
    }

    public boolean isDoIdentfilter(String abbr) {
        return !StringUtils.isBlank(abbr) && abbr.length() >= 3;
    }

    public String getAbbr() {
        if (this.abbr == null) {
            return "";
        }
        return this.abbr;
    }

    public String getFNoteNum() {
        return this.fNoteNum;
    }

    public String getGroup() {
        return this.group;
    }

    public String getListNum() {
        if (this.listNum == null) {
            return "";
        }
        return this.listNum;
    }

    public String getRevVer() {
        return this.revVer;
    }

    public String getText() {
        if (this.text == null) {
            return "";
        }
        return this.text;
    }

    public String getSpecVer() {
        return this.specVer;
    }

    public String getFnRecGrp() {
        return this.fnRecGrp;
    }

    public String getCatSource() {
        return this.catSource;
    }

    public void setAbbr(String string) {
        if (string == null) {
            this.abbr = "";
        } else {
            this.abbr = string;
        }
    }

    public void setFNoteNum(String string) {
        if (string == null) {
            this.fNoteNum = "";
        } else {
            this.fNoteNum = string;
        }
    }

    public void setGroup(String string) {
        this.group = string;
    }

    public void setListNum(String string) {
        if (string != null) {
            this.listNum = string;
        } else {
            this.listNum = "";
        }
    }

    public void setLang(String lang) {
        this.lang = lang;
        this.needToReprocessText = true;
    }

    public String getLang() {
        return this.lang;
    }

    public void setRevVer(String string) {
        this.revVer = string;
    }

    public void setText(String string) {
        if (string == null) {
            this.text = "";
        } else {
            this.text = string;
        }
        this.needToReprocessText = true;
    }

    public void setSpecVer(String string) {
        this.specVer = string;
    }

    public void setFnRecGrp(String string) {
        this.fnRecGrp = string;
    }


    public int isValid(BenzVinInfoDTO benzVinInfoDTO, int statusCKD) {
        return this.isValid(null, benzVinInfoDTO, statusCKD);
    }

    public boolean hasMoreDisplayable() {
        return this.hasMoreElements;
    }

    public Object[] getNextDisplayable() {
        return new Object[0];
    }

    public abstract int isValid(FootnoteList p0, BenzVinInfoDTO benzVinInfoDTO, int statusCKD);

    public TableCellRenderer[] getColumnRenderers() {
        return null;
    }

    public boolean getIsAssociated() {
        return this.isAssociated;
    }

    public void setIsAssociated(boolean isAssociated) {
        this.isAssociated = isAssociated;
    }

    protected void parseNeutralText() {
        if (this.needToReprocessText) {
            this.codeBs = "";
            this.linkedFoootnotes = "";
            this.es2Codes = "";
            this.hasLink = false;
            if ((this.lang == null || this.lang.length() == 0 || this.lang.equals("N")) && this.text != null && this.text.length() > 0) {
                if (this.text.length() > 21) {
                    this.codeBs = this.text.substring(21).trim();
                    if (this.codeBs != null && !this.codeBs.equals("") && this.getCatSource() != null && this.getCatSource().equals("D")) {
                        this.isAccessoryFootnote = BenzStringUtil.isAccessoryRecord(this.codeBs, this.getCatSource());
                    }
                }
                if (this.text.length() > 5) {
                    if (this.text.length() > 21) {
                        this.linkedFoootnotes = this.text.substring(5, 21).trim();
                    } else {
                        this.linkedFoootnotes = this.text.substring(5).trim();
                    }
                    if (this.linkedFoootnotes.length() > 0) {
                        this.hasLink = true;
                    }
                }
                if (this.text.length() > 0) {
                    if (this.text.length() > 5) {
                        this.es2Codes = this.text.substring(0, 5).trim();
                    } else {
                        this.es2Codes = this.text.trim();
                    }
                }
            }
        }
        this.needToReprocessText = false;
    }

    public String getCodeBs() {
        this.parseNeutralText();
        return this.codeBs;
    }

    public String getEs2Codes() {
        this.parseNeutralText();
        return this.es2Codes;
    }

    public String getLinkedFoootnotes() {
        this.parseNeutralText();
        return this.linkedFoootnotes;
    }

    public int getSeqNum() {
        return this.seqNum;
    }

    public void setSeqNum(int seqNum) {
        this.seqNum = seqNum;
    }

    public String getIdent() {
        return this.ident;
    }

    public String getDate() {
        return this.date;
    }

    public String getModelyr() {
        return this.modelyr;
    }

    public float getCodeBScore() {
        return this.codeBScore;
    }

    public void setCodeBScore(float codeBScore) {
        this.codeBScore = codeBScore;
    }

    public String getKb() {
        return this.kb;
    }

    public void setKb(String kb) {
        if (kb == null) {
            kb = "";
        } else {
            this.kb = kb;
        }
    }

    public void setCatSource(String catSource) {
        this.catSource = catSource;
    }

}
